<?php

	/*
	**	HTMLHandler
	*/

	class	HTMLHandler{
	
		private	$_type;
		
		private	$_attrs;
                
                private $_label;
                
                public function setLabel($label){
                    
                    $this->_label = $label;
                }

                public function getLabel(){
                    
                    return $this->_label;
                }

                public	function	setAttrs($_attrs){
		
			$this	->	_attrs	=	$_attrs;
		
		}
		
		public	function	setType($_type){
					
			$this	->	_type	=	$_type;
		
		}
                
                public function setDisplayValue($dispVal){
                    
                    $this->_attrs["value"] = $dispVal;
                
                    
                }

                public	function	getAttrs(){
		
			return	$this	->	_attrs;
		
		}
		
		public	function	getType(){
		
			return	$this	->	_type;
		
		}
		
		public	function	render(){
		
			$_attrs	=	$this	->	getAttrs();
                        
                        $_type  =       $this   ->      getType();
			
			if (!$_attrs) {
                            
                            $_attrs =   array('name'=>$_type,'class'=>$_type,'id'=>$_type);
                        }
                    
                        $_attr_names	=	array_keys($_attrs);
			
			foreach(	$_attr_names	as	$key){
			
				$_attr_value	=	$_attrs[$key];
				
				$string	.=	$key.'="'.$_attr_value.'" ';
			
			}

			switch ($this->getType()) {
                            
                            case 'text':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'password':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'hidden':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'checkbox':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'radio':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'file':
                                    
                                return	'<input	type="'.$this	->	getType().'" '.$string.'/>';
                                
                                break;
                            
                            case 'textarea':
                                    
                                return	'<textarea '.$string.'></textarea>';
                                
                                break;

                        }
		
		}
	}
?>